﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace EnqueteMobile.Repository.Base
{
    public interface IRepository<T>
    {
        IQueryable<T> GetAll();

        T GetById(params object[] keyValues);

        T Add(T entity);

        ICollection<T> AddRange(ICollection<T> entityCollection);

        void Remove(T entity);

        void Update(T entity);

        void BulkInsert(ICollection<T> entityCollection);

        void BulkInsert(ICollection<T> entityCollection, SqlTransaction sqlTransaction);

        void BulkUpdate(ICollection<T> entityCollection, PropertyInfo[] columnsToUpdate);

        void BulkUpdate(ICollection<T> entityCollection, params Expression<Func<T, object>>[] columnsToUpdate);

        void BulkUpdate(ICollection<T> entityCollection, SqlTransaction sqlTransaction, params Expression<Func<T, object>>[] columnsToUpdate);

        SqlConnection GetOpenSqlConnection();
    }
}